#!-*- coding:utf-8 -*-

from .models import UserImage


def setUserImage(user, imgpath, article):
    imgs = UserImage.objects.filter(user=user, path=imgpath);
    if len(imgs) != 1: return False
    img = imgs[0]

    img.article = article
    img.save()

    return True
